import request from '@/utils/request'

/** **
 *
 * 获取组织结构信息
 *
 * ******/
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

/** **
 *
 * 根据ID删除部门
 *
 * *******/
export function delDepartments(id) {
  return request({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}

/** ****
 *
 * 封装新增部门的api模块
 * Body
 *
 * ********/
export function addDepartments(data) {
  return request({
    method: 'POST',
    url: '/company/department',
    data
  })
}
/** **
 *
 * 获取员工信息
 *
 * ******/
export function getEmployeeSimple() {
  return request({
    method: 'GET',
    url: '/sys/user/simple'
  })
}
/** **
 *
 * 根据id获取部门信息的方法
 *
 * *******/
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}
/** ********
 *
 * 编辑部门接口
 * 这里需要id 和 data data里有id直接传入data即可
 *
 * **************/
export function updateDepartments(data) {
  return request({
    method: 'put',
    url: `/company/department/${data.id}`,
    data
  })
}
